#!/bin/bash

registry=registry.cn-shenzhen.aliyuncs.com/jiangwenyu
version=v0.0.1

export GO111MODULE=on
export GOPROXY=https://goproxy.cn
echo go mod tidy
go mod tidy
echo go build
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o admission-webhook-demo

echo docker build
docker build --no-cache -t ${registry}/admission-webhook-demo:${version} .
rm -rf admission-webhook-demo

echo docker push
docker push ${registry}/admission-webhook-demo:${version}
